import request from '@/utils/request'

// 查询商品分组信息列表
export function listGroup(query) {
  return request({
    url: '/prod-api/product/group/list',
    method: 'get',
    params: query
  })
}

export function firstGroupList(query) {
  return request({
    url: '/prod-api/product/group/firstGroupList',
    method: 'get',
    params: query
  })
}

// 查询商品分组信息详细
export function getGroup(groupUid) {
  return request({
    url: '/prod-api/product/group/' + groupUid,
    method: 'get'
  })
}

//查询分组信息集合
export function listByType(groupUid,type) {
  return request({
    url: '/prod-api/product/group/listByType/' + groupUid+"/"+type,
    method: 'get'
  })
}



// 新增商品分组信息
export function addGroup(data) {
  return request({
    url: '/prod-api/product/group',
    method: 'post',
    data: data
  })
}

// 修改商品分组信息
export function updateGroup(data) {
  return request({
    url: '/prod-api/product/group',
    method: 'put',
    data: data
  })
}

// 修改商品分组状态
export function updateGroupStatus(groupUid, dataStatus){
  const data = {
    groupUid,
    dataStatus
  }
  return request({
    url: '/prod-api/product/group',
    method: 'put',
    data: data
  })
}

// 删除商品分组信息
export function delGroup(groupUid) {
  return request({
    url: '/prod-api/product/group/' + groupUid,
    method: 'delete'
  })
}

export function updateRecommend(data){

  return request({
    url: '/prod-api/product/group/updateRecommend',
    method: 'post',
    data: data
  })
}
